﻿@using AirlineBooking.Models.DTO
@model List<DTOIntineraryOptions>
@{
    ViewBag.Title = "FindIntinerary";
}
<h2>
    FindIntinerary</h2>
@{ int count = 0;}
<ul>
    @foreach (DTOIntineraryOptions intinerary in Model)
    {
        if (intinerary.ClassType != null)
        {
            count++;
        <li>Option @count: Class: @intinerary.ClassType.Value
            <br />
            @intinerary.Departure.Name (@intinerary.Departure.Code)
            <br />
            @intinerary.Destination.Name (@intinerary.Destination.Code)
            <br />
            @{int connectionCount = 0;}
            <ul>
                @foreach (DTOFlightOptions con in intinerary.Connections)
                {
                    connectionCount++;
                    <li>Connection @connectionCount:
                        <br />
                        @con.Departure.Name (@con.Departure.Code)
                        <br />
                        @con.Destination.Name (@con.Destination.Code)
                        <br />
                        @foreach (DTOFlight flight in con.Flights)
                        {
                            <text>@flight.FlightCode</text>
                            <text>@flight.DepatureTime</text>
                            <text>@flight.ArrivalTime</text>
                            <text>@flight.Operator</text>
                            <text>@flight.ClassType.Value</text>
                            
                            <text>@flight.Price</text>
                            <br />
                        }
                    </li>
                }
            </ul>
        </li>
        }
    }
</ul>
